<form id="edit-form" class="form-horizontal" role="form" data-toggle="validator" method="POST" action="">
    <div class="form-group">
        <label class="control-label col-xs-12 col-sm-2">{:__('Type')}:</label>
        <div class="col-xs-12 col-sm-8">
            {:build_select('row[type]', $typeList, $row['type'])}
      
        </div>
    </div>
    <div class="form-group">
        <label class="control-label col-xs-12 col-sm-2">{:__('Category_id')}:</label>
        <div class="col-xs-12 col-sm-8">
            <input id="c-category_id" data-rule="required" data-source="goods_category/index" data-params='{"custom[status]":1}' class="form-control selectpage" name="row[category_id]" type="text" value="{$row.category_id|htmlentities}">
        </div>
    </div>
    <div class="form-group">
        <label class="control-label col-xs-12 col-sm-2">{:__('Seller_id')}:</label>
        <div class="col-xs-12 col-sm-8">
            <input id="c-seller_id"  data-source="seller/index" class="form-control selectpage" name="row[seller_id]" type="text" value="{$row.seller_id|htmlentities}">
        </div>
    </div>
    <div class="form-group">
        <label class="control-label col-xs-12 col-sm-2">{:__('Goods_name')}:</label>
        <div class="col-xs-12 col-sm-8">
            <input id="c-goods_name" data-rule="required" class="form-control" name="row[goods_name]" type="text" value="{$row.goods_name|htmlentities}">
        </div>
    </div>
    <div class="form-group">
        <label class="control-label col-xs-12 col-sm-2">{:__('Image')}:</label>
        <div class="col-xs-12 col-sm-8">
            <div class="input-group">
                <input id="c-image" data-rule="required" class="form-control" size="50" name="row[image]" type="text" value="{$row.image|htmlentities}">
                <div class="input-group-addon no-border no-padding">
                    <span><button type="button" id="plupload-image" @click="upload(index)" class="btn btn-danger plupload" data-input-id="c-image" data-mimetype="image/gif,image/jpeg,image/png,image/jpg,image/bmp" data-multiple="false" data-preview-id="p-image"><i class="fa fa-upload"></i> {:__('Upload')}</button></span>
                    <span><button type="button" id="fachoose-image" class="btn btn-primary fachoose" data-input-id="c-image" data-mimetype="image/*" data-multiple="false"><i class="fa fa-list"></i> {:__('Choose')}</button></span>
                </div>
                <span class="msg-box n-right" for="c-image"></span>
            </div>
            <ul class="row list-inline plupload-preview" id="p-image"></ul>
        </div>
    </div>
    <div class="form-group">
        <label class="control-label col-xs-12 col-sm-2">{:__('Banner_images')}:</label>
        <div class="col-xs-12 col-sm-8">
            <div class="input-group">
                <input id="c-banner_images" class="form-control" size="50" name="row[banner_images]" type="text" value="{$row.banner_images|htmlentities}">
                <div class="input-group-addon no-border no-padding">
                    <span><button type="button" id="plupload-banner_images" class="btn btn-danger plupload" data-input-id="c-banner_images" data-mimetype="image/gif,image/jpeg,image/png,image/jpg,image/bmp" data-multiple="true" data-preview-id="p-banner_images"><i class="fa fa-upload"></i> {:__('Upload')}</button></span>
                    <span><button type="button" id="fachoose-banner_images" class="btn btn-primary fachoose" data-input-id="c-banner_images" data-mimetype="image/*" data-multiple="true"><i class="fa fa-list"></i> {:__('Choose')}</button></span>
                </div>
                <span class="msg-box n-right" for="c-banner_images"></span>
            </div>
            <ul class="row list-inline plupload-preview" id="p-banner_images"></ul>
        </div>
    </div>

    <div class="form-group">
        
        <label class="control-label col-xs-12 col-sm-2">{:__('Price')}:</label>
        <div class="col-xs-12 col-sm-8">
            <input id="c-price" data-rule="required" class="form-control" step="0.01" name="row[price]" min="0" type="number" value="{$row.price|htmlentities}">
        </div>
    </div>
    <div class="form-group">
        <label class="control-label col-xs-12 col-sm-2">{:__('Market_price')}:</label>
        <div class="col-xs-12 col-sm-8">
            <input id="c-market_price" class="form-control" step="0.01" name="row[market_price]" min="0" type="number" value="{$row.market_price|htmlentities}">
        </div>
    </div>
    <div class="form-group">
        <label class="control-label col-xs-12 col-sm-2">{:__('Commission')}:</label>
        <div class="col-xs-12 col-sm-8">
            <input id="c-commission" class="form-control" step="0.01" name="row[commission]" min="0" type="number" value="{$row.commission|htmlentities}">
        </div>
    </div>
    <div class="form-group">
        <label class="control-label col-xs-12 col-sm-2">{:__('View_commission')}:</label>
        <div class="col-xs-12 col-sm-8">
            <input id="c-view_commission" class="form-control" step="0.01" name="row[view_commission]" min="0" type="number" value="{$row.view_commission|htmlentities}">
        </div>
    </div>
    <div class="form-group">
        <label class="control-label col-xs-12 col-sm-2">{:__('Stock_number')}:</label>
        <div class="col-xs-12 col-sm-8">
            <input id="c-stock_number" data-rule="required" class="form-control" name="row[stock_number]" step="1" min="0" type="number" value="{$row.stock_number|htmlentities}">
        </div>
    </div>
    <div class="form-group">
        <label class="control-label col-xs-12 col-sm-2">{:__('Page_views')}:</label>
        <div class="col-xs-12 col-sm-8">
            <input id="c-page_views" class="form-control" name="row[page_views]" type="number" min="0" step="1" value="{$row.page_views|htmlentities}">
        </div>
    </div>
    <div class="form-group">
        <label class="control-label col-xs-12 col-sm-2">{:__('Sale_number')}:</label>
        <div class="col-xs-12 col-sm-8">
            <input id="c-sale_number" class="form-control" name="row[sale_number]" type="number" min="0" step="1" value="{$row.sale_number|htmlentities}">
        </div>
    </div>
    <div class="form-group">
        <label class="control-label col-xs-12 col-sm-2">{:__('Sort')}:</label>
        <div class="col-xs-12 col-sm-8">
            <input id="c-sort" class="form-control" name="row[sort]" type="number" min="1" value="{$row.sort|htmlentities}">
        </div>
    </div>
    <div class="form-group">
        <label class="control-label col-xs-12 col-sm-2">{:__('Status')}:</label>
        <div class="col-xs-12 col-sm-8">
            {:build_radios('row[status]', $statusList, 1)}
        </div>
    </div>

    
    <div role="tabpanel" class="tab-pane" id="spec">
        <table class="table table-bordered">
            <tr class="alert-success">
                <th>规格名称</th>
                 <th>库存</th>
                <th>价格</th>
                <th>图片</th>
                <th>操作</th>
            </tr>
            <tbody>
            
            <tr v-for="(item, index) in specs">
                <td>
                    <input :id="'c-name-'+index" data-rule="required" class="form-control" :name="'row[spec]['+index+'][name]'" type="text" v-model="item.name">
                </td>
                <td>
                    <input :id="'c-stock_count-'+index" data-rule="required" class="form-control" :name="'row[spec]['+index+'][stock_number]'"  type="number" step="1" min="0" v-model="item.stock_number">
                </td>
                <td>
                    <input :id="'c-price-'+index"  class="form-control" :name="'row[spec]['+index+'][price]'"  type="number" min="0" v-model="item.price">
                </td>
                <input type="hidden" :name="'row[spec]['+index+'][id]'" v-model="item.id">
                <td>
                    <div class="input-group">
                        <input :id="'c-specimage-'+index" data-rule="required" class="form-control" size="50" :name="'row[spec]['+index+'][image]'" type="text" v-model="item.image">
                        <div class="input-group-addon no-border no-padding">
                            <span><button type="button" :id="'plupload-image'+index" @click="upload(index)" data-upload-success="upload_success" class="btn btn-danger plupload" :data-input-id="'c-specimage-'+index" data-mimetype="image/gif,image/jpeg,image/png,image/jpg,image/bmp" data-multiple="false" :data-preview-id="'p-specimage-'+index"><i class="fa fa-upload"></i> {:__('Upload')}</button></span>
                            <span><button type="button" :id="'fachoose-image'+index" class="btn btn-primary fachoose" :data-input-id="'c-specimage-'+index" data-mimetype="image/*" data-multiple="false"><i class="fa fa-list"></i> {:__('Choose')}</button></span>
                        </div>
                        <span class="msg-box n-right" :for="'c-specimage-'+index"></span>
                    </div>
                    <ul class="row list-inline plupload-preview" :id="'p-specimage-'+index"></ul>
                </td>
                <td>
                    <button class="btn btn-danger btn-sm" type="button" @click="del_spec(item, index)">删除</button>
                </td>
            </tr>
            </tbody>
        </table>
        <button class="btn btn-info add-spec" @click="add_spec()" type="button">加一列</button>
    </div>
    
    <div class="form-group">
        <label class="control-label col-xs-12 col-sm-2">{:__('Content')}:</label>
        <div class="col-xs-12 col-sm-8">
            <textarea id="c-content" class="form-control editor" rows="5" name="row[content]" cols="50">{$row.content|htmlentities}</textarea>
        </div>
    </div>
    <div class="form-group layer-footer">
        <label class="control-label col-xs-12 col-sm-2"></label>
        <div class="col-xs-12 col-sm-8">
            <button type="submit" class="btn btn-success btn-embossed disabled">{:__('OK')}</button>
            <button type="reset" class="btn btn-default btn-embossed">{:__('Reset')}</button>
        </div>
    </div>
</form>

<script src="https://unpkg.com/vue@2.5.16/dist/vue.js"></script>
